#ifndef __SEND_RECV_MANAGER__
#define __SEND_RECV_MANAGER__

#include <string>
#include <Poco/Types.h>

#include <UDTClient.h>
#include <QObject>
#include <QThread>
class SendRecvManager
        :public QThread
{
    Q_OBJECT
public:
	enum eSendRecvType
	{
		eSend = 0,
		eRecv = 1
	};
public:
	SendRecvManager(void);
	SendRecvManager(int aType, const std::string& aPathFile, Poco::Int64 aSession , const std::string& aDir);
public:
	virtual ~SendRecvManager(void);
public:
	void Execute();

        void run() {Execute (); }

		void SetID(const std::string& aID){ID = aID;};
signals:
        void ConnectedToPeer();
        void ConnectFailed();
        void ReceivedFileDescription(bool aStatus);
        void SentFileDescription(bool aStatus);

        void PieceReceived(int aPieceIndex);
        void PieceSent(int aPieceIndex);
        void TotalPiecesCount(int);
        void TotalFileSizeInfo(Poco::UInt64);

        //void Finished();

private:
	int iType;
	std::string iPathFile;
	std::string iFileName;
	Poco::Int64 iSession;
	std::string iDir;

	std::string ID;

	UDTSOCKET iClient;
        int     iRetryNumber;
};
#endif
